package cn.edu.zzu.demo02Thread;

public class TestLambda2 {

    public static void main(String[] args) {

        Calculate calculate = null ;

        //1.标准lambda
        calculate = (int a)->{
            System.out.println("结果："+a);
        };
        calculate.cal(555);

        //2.省略类型
        calculate = (a)->{
            System.out.println("结果："+a);
        };
        calculate.cal(554);

        //3.省略括号
        calculate = a->{
            System.out.println("结果："+a);
        };
        calculate.cal(553);

        //4.省略花括号
        calculate =  a -> System.out.println("结果："+a); //多行代码 需要代码块包裹
        calculate.cal(552);
    }

}

/**
 * 函数式接口
 */
interface Calculate{
    void cal(int a);
}